using Microsoft.EntityFrameworkCore;
using TCEntity;

namespace TCDbService
{
  public class TCDbContext : DbContext
  {
    public TCDbContext(DbContextOptions options) : base(options)
    {
      Database.EnsureCreated();
    }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
      modelBuilder.Entity<User_Community>().HasKey(entity => new { entity.Username, entity.CommunityId });
    }
    public DbSet<User> Users { get; set; }
    public DbSet<Image> Images { get; set; }
    public DbSet<Community> Communities { get; set; }
    public DbSet<User_Community> Users_Communities { get; set; }
    public DbSet<SharedImage> SharedImages { get; set; }
  }
}
